﻿@page "/test-tabs"
@attribute [ReuseTabsPage(Title = "TestTabs",Pin = true)]
@inject ReuseTabsService _reuseTabsService

<h3>TestTabs</h3>

<Button OnClick="ClosePage">Close Counter1</Button>
<Button OnClick="CloseOther">Close Other</Button>
<Button OnClick="CloseAll">Close All</Button>
<Button OnClick="CloseCurrent">Close current</Button>
<Button OnClick="Reload">Reload Current</Button>

Render count: @count

@code {
    int count;

    protected override void OnAfterRender(bool firstRender)
    {
        count++;
        base.OnAfterRender(firstRender);
    }

    void ClosePage()
    {
        _reuseTabsService.ClosePage("/counter/1");
    }

    void CloseOther()
    {
        _reuseTabsService.CloseOther("/test-tabs");
    }

    void CloseAll()
    {
        _reuseTabsService.CloseAll();
    }

    void CloseCurrent()
    {
        _reuseTabsService.CloseCurrent();
    }

    void Reload()
    {
        _reuseTabsService.ReloadPage();
    }
}
